import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/resources/colours.dart';
import 'package:sports_new/resources/styles.dart';
import 'package:sports_new/utils/utils.dart';
import 'package:sports_new/utils/widget_utils.dart';

import 'base/qkd_text.dart';

class ScorePredictionWidget extends StatelessWidget {
  const ScorePredictionWidget(
      {super.key,
      required this.homeLogo,
      required this.homeName,
      required this.guestLogo,
      required this.guestName,
      required this.homeScore,
      required this.guestScore});

  final String homeLogo;
  final String homeName;
  final String guestLogo;
  final String guestName;
  final String homeScore;
  final String guestScore;

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Image.asset(
            height: 72,
            width: Get.width,
            fit: BoxFit.fill,
            Utils.getImgPath("predict_bg.png")),
        Column(
          children: [
            Container(height: 3),
            Image.asset(
                width: 68, height: 24, Utils.getImgPath("predict_score.png")),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 12),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  CachedNetworkImage(
                      width: 32,
                      height: 32,
                      placeholder: (context, url) => Styles.placeholderIcon(),
                      errorWidget: (context, url, error) =>
                          Image.asset(Utils.getImgPath("zq_placeholder.png")),
                      imageUrl: homeLogo),
                  Container(height: 3),
                  Expanded(
                    child: QkdText(homeName,
                      color: Colors.white, fontSize: 12
                    ).center,
                  ),
                  Stack(
                    children: [
                      Image.asset(
                          height: 34,
                          width: 100,
                          Utils.getImgPath("predict_board.png")),
                      SizedBox(
                        width: 100,
                        child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              QkdText(homeScore,
                                fontFamily: "Din",
                                fontSize: 28,
                                height: 1.1,
                                color: Colours.text,
                                fontWeight: FontWeight.w600
                              ),
                              Container(width: 5),
                              const QkdText(":",
                                fontFamily: "Din",
                                fontSize: 28,
                                height: 0.7,
                                color: Colours.text,
                                fontWeight: FontWeight.w600
                              ),
                              Container(width: 5),
                              QkdText(guestScore,
                                fontFamily: "Din",
                                fontSize: 28,
                                height: 1.1,
                                color: Colours.text,
                                fontWeight: FontWeight.w600
                              )
                            ]),
                      )
                    ],
                  ),
                  Expanded(
                    child: QkdText(guestName,
                      color: Colors.white, fontSize: 12
                    ).center,
                  ),
                  Container(height: 3),
                  CachedNetworkImage(
                      width: 32,
                      height: 32,
                      placeholder: (context, url) => Styles.placeholderIcon(),
                      errorWidget: (context, url, error) =>
                          Image.asset(Utils.getImgPath("zq_placeholder.png")),
                      imageUrl: guestLogo),
                ],
              ),
            )
          ],
        )
      ],
    );
  }
}
